//
// NewGame.cpp for  in /home/gomes_m//svn/google/ticket-pour-gdl/menu_V1
// 
// Made by mickael gomes
// Login   <gomes_m@epitech.net>
// 
// Started on  Fri May 10 17:47:56 2013 mickael gomes
// Last update Thu May 30 13:51:22 2013 mickael gomes
//

#include		<sstream>
#include		"NewGame.hh"

NewGame::NewGame()
{
  int		i = 0;

  while (i < 12)
    {
      tabNumber_.push_back(new Numbers);
      i++;
    }
}

NewGame::~NewGame()
{
}

void			NewGame::resetPos(Vector3f &coord)
{
  coord.posX1_ = 20;
  coord.posY1_ = 270;
  coord.posX2_ = 100;
  coord.posY2_ = 210;
  coord.posZ_ = 0;
  coord.moveX_ = 0;
  coord.moveY_ = 0;
  coord.moveXValue_ = 0;
  coord.moveYValue_ = 120;
  coord.limitXValue_ = 0;
  coord.limitYValue_ = -360;
}

void			NewGame::initialize(void)
{
  image_.initialize("images/options.png", -900, 660, 930, -630, -1);
  tabNumber_[0]->initialize("images/numbers.png", 670, 270, 720, 220, 0);
  tabNumber_[1]->initialize("images/numbers.png", 720, 270, 770, 220, 0);
  tabNumber_[2]->initialize("images/numbers.png", 770, 270, 820, 220, 0);
  tabNumber_[3]->initialize("images/numbers.png", 670, 150, 720, 100, 0);
  tabNumber_[4]->initialize("images/numbers.png", 720, 150, 770, 100, 0);
  tabNumber_[5]->initialize("images/numbers.png", 770, 150, 820, 100, 0);
  tabNumber_[6]->initialize("images/numbers.png", 670, 30, 720, -20, 0);
  tabNumber_[7]->initialize("images/numbers.png", 720, 30, 770, -20, 0);
  tabNumber_[8]->initialize("images/numbers.png", 770, 30, 820, -20, 0);
  tabNumber_[9]->initialize("images/numbers.png", 670, -90, 720, -140, 0);
  tabNumber_[10]->initialize("images/numbers.png", 720, -90, 770, -140, 0);
  tabNumber_[11]->initialize("images/numbers.png", 770, -90, 820, -140, 0);
  image_.initVertex();
}

void			NewGame::update(Key key, Cursor &cursor)
{
  if (key == UP || key == DOWN || key == B)
    cursor.update(key);
  else if (key == LEFT || key == RIGHT)
    tabNumber_[(cursor.coord.moveY_ / -cursor.coord.moveYValue_) * 3]->update(key, cursor);
}

void			NewGame::draw(void)
{
  int			i = 0;

  image_.draw();
  while (i < 12)
    tabNumber_[i++]->draw();
}

void			NewGame::unload()
{

}
